﻿var prog_name = "krj_defect_bulletin.js";
function SelectRows() {
    try
    {
        if (!$(".SelectedRow").length > 0) {
            alert('請選取一筆資料!!');
            return false;
        }
        else
            return true;
    }
    catch (err) {
        txt = "程式發生錯誤！\n";
        txt += "錯誤訊息: " + err.message + "\n\n";
        txt += "請按確定繼續.\n\n";
        alert(txt);
        save_error(prog_name, "SelectRows", "USER", "js", err);
        return false;
    }
}

function btnSearch_Click(p_PageIndex) {
    try
    {
        //畫面檢核
        if ($("#MainContent_ddlDISPATCH_DEPT").val() == "" || $("#MainContent_txt_START_DATE").val() == "") {
            alert('請輸入發送所站及點貨日!!');
            return false;
        }
    
        var sType = '';
        var sORDER = '';
        sType = 'A';
        sORDER = 'F60505,F60506,F60508,F60507,F60517';
        //頁次
        var m_PageIndex = getPageIndex(p_PageIndex);

        //查詢條件 對應後端查詢條件
        var StrWhere = { DISPATCH_DEPT: $("#MainContent_ddlDISPATCH_DEPT").val(), CHECK_DATE: $("#MainContent_txt_START_DATE").val(), txtRECEIVER: $("#MainContent_txtRECEIVER").val() };

        //組Grid 公用Function 後端網頁名稱, 查詢FUNCTION名稱, 頁次, 一頁筆數, 排序條件, 查詢條件, 目標 DIV
        gdb_DataBind("krj_tracking_defect_bulletin", "GetTracking_Defect", m_PageIndex, "15", sORDER, StrWhere, "Document");

    }
    catch (err) {
        txt = "程式發生錯誤！\n";
        txt += "錯誤訊息: " + err.message + "\n\n";
        txt += "請按確定繼續.\n\n";
        alert(txt);
        save_error(prog_name, "btnSearch_Click", "USER", "js", err);
        return false;
    }

}